<template>
  <div class="maptip-container">
    <div class="tips-control">
      <div
        class="item"
        v-for="(item, index) in statusList"
        :key="index"
        @click="onStatus(item)"
        :style="item.icActive ? 'opacity: 1;' : 'opacity: 0.5;'"
      >
        <div>
          <img :src="item.icon" alt="" />
        </div>
        <span>{{ item.name }}</span>
      </div>
      <div class="lb"></div>
      <div class="rb"></div>
      <div class="tb"></div>
      <div class="bb3"></div>
    </div>
  </div>
</template>

<script>
export default {
  name: "mapTip",
  props: ["cureentMenu"],
  data() {
    return {
      colors: [
        this.$store.state.redIcon,
        this.$store.state.blueIcon,
        this.$store.state.blueIcon,
        this.$store.state.greenIcon,
        this.$store.state.orangeIcon,
        this.$store.state.yellowIcon,
        this.$store.state.redIcon,
        this.$store.state.blueIcon,
        this.$store.state.greenIcon,
        this.$store.state.orangeIcon,
        this.$store.state.yellowIcon,
      ],
      statusList0: [
        {
          name: "自建房感知监测",
          icon: this.$store.state.redIcon,
          icActive: true,
        },
        {
          name: "用电感知",
          icon: this.$store.state.blueIcon,
          icActive: true,
        },
        {
          name: "人员分布",
          icon: this.$store.state.yellowIcon,
          icActive: true,
        },
      ],
      statusList1: [
        {
          name: "正常",
          icon: this.$store.state.greenIcon,
          icActive: true,
        },
        {
          name: "温度预警",
          icon: this.$store.state.blueIcon,
          icActive: true,
        },
        {
          name: "电压预警",
          icon: this.$store.state.yellowIcon,
          icActive: true,
        },
        {
          name: "电流预警",
          icon: this.$store.state.orangeIcon,
          icActive: true,
        },
        {
          name: "漏电预警",
          icon: this.$store.state.redIcon,
          icActive: true,
        },
        {
          name: "设备离线",
          icon: this.$store.state.grayIcon,
          icActive: true,
        },
      ],
      statusList2: [
        {
          name: "人员分布",
          icon: this.$store.state.yellowIcon,
          icActive: true,
        },
      ],
      statusList: [],
    };
  },
  watch: {
    cureentMenu: {
      handler(newVal) {
        if (newVal == 0) {
          this.statusList = this.statusList0;
        }
        if (newVal == 2) {
          this.statusList = this.statusList1;
        }
        if (newVal == 3) {
          this.statusList = this.statusList2;
        }
      },
      immediate: true,
    },
  },
  methods: {
    onStatus(item) {
      // item.icActive = !item.icActive;
      console.log(window.$SOURCE_MAP);
    },
  },
};
</script>
<style scoped lang="scss">
.maptip-container {
  .tips-control {
    width: 100%;
    border-radius: 3px;
    border: 2.5px solid rgba(39, 69, 107, 1);
    background: rgba(11, 33, 74, 0.6);
    clip-path: polygon(7% 0, 100% 0, 100% 0, 100% 100%, 0% 100%, 0 20px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    position: relative;

    .item {
      display: flex;
      flex-direction: row;
      align-items: center;
      justify-content: flex-start;
      color: #fff;
      font-size: 0.16rem;
      line-height: 2vh;
      padding: 0.6vh 1vw;
      cursor: pointer;
      > div {
        width: 1.2vw;
        height: 4vh;
        margin-right: 0.6vw;
        > img {
          width: 100%;
          height: 100%;
        }
      }
    }
    .item:first-child {
      margin-top: 1.5vh;
    }
    .item:last-child {
      margin-bottom: 1.5vh;
    }
  }
}
</style>
